Skip to content

Conversation

@niklashaug
Copy link
Member

@niklashaug niklashaug commented Mar 6, 2025

closes #22

expect,
skip: (reason) => {
test.skip(reason);
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@niklashaug Does it make sense to pass skip here? Afaik skip needs to be called before the test is executed. But maybe that's a special feature of the node test runner (which I haven't used yet).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The node test runner supports skipping a test while being run: https://nodejs.org/api/test.html#skipping-tests

I just had a look, Jest for example doesn't seem to support it.
What I could do is, do the check whether the test should be skipped before returning inside of the map function, so that any test I want to skip is just not returned and therefore will not be run at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. It depends on whether you want to show to the user that there is a test but it is skipped (for whatever reason).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just thought about it again and noticed that this would mean that I'd have to execute parts of the test inside of the generateTestCases() function. But the main purpose of this function and the according method for the consumer should be to return the test cases which should be executed in a later step.
So I'll probably call skip if skip is defined and otherwise just let the test pass and additionally print out a warning or something similar.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good 👍

# Conflicts:
#	src/api/index.ts
#	src/core/policy/policy-decision-point.ts
#	src/core/tests/runner/node-test-runner.ts
#	src/core/tests/runner/test-runner.ts
#	src/core/tests/test-executor.ts
#	src/core/tests/testcase-generator.ts
#	tests/mock-server.ts
#	tests/unit/test-executor.spec.ts
@niklashaug niklashaug merged commit 4c61e86 into main Mar 10, 2025
1 check passed
@niklashaug niklashaug deleted the testrunner-setup branch March 10, 2025 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bring-your-own-Testrunner

2 participants